import {
  reqBanner,
  reqLike,
  reqNavList,
  reqRecommend
} from '../../api/index';
Page({
  /**
   * 页面的初始数据
   */
  data: {
    bannerArr: [], //首页轮播图的数据
    navArr: [], //导航列表数据
    likeArr:[],//猜你喜欢
    recommendArr:[],//热门推荐
  },
  onLoad(options) {
    //获取首页轮播
    this.getBanner();
    //导航列表
    this.getNavList();
    //获取猜你喜欢
    this.getLike();
    //推荐
    this.getRecommend();
  },
  //首页banner
  async getBanner() {
    let result = await reqBanner();
    if (result.code == 200) {
      this.setData({
        bannerArr: result.data
      })
    }
  },
  //导航列表
  async getNavList() {
    let result = await reqNavList();
     if(result.code==200){
       this.setData({
            navArr:result.data
       })
     }
  },
  //获取猜你喜欢
  async getLike(){
    let result  = await reqLike();
    if(result.code==200){
      this.setData({
        likeArr:result.data
      })
    }
  },
  async getRecommend(){
    let result = await reqRecommend();
    if(result.code==200){
      this.setData({
        recommendArr:result.data
      })
    }
  }


})